package com.yequan.hbb.presenter;

import android.util.Log;
import android.widget.Toast;

import com.yequan.hbb.entries.AnswerEntries;
import com.yequan.hbb.entries.QuestionEntries;
import com.yequan.hbb.model.QuesrionModel;
import com.yequan.hbb.view.QuestionView;

import retrofit2.Call;
import retrofit2.Response;

/**
 * Created by DingLong on 2016/10/14.
 */

public class QuestionPresenter extends MVPPresenter<QuestionView<QuestionEntries,AnswerEntries>,QuesrionModel> implements QuesrionModel.QuesrionCallBack {

    private QuesrionModel model;

    @Override
    public QuesrionModel createModel() {
        model = new QuesrionModel(this);
        return model;
    }

    public void getQuestionData(int contentId) {
        model.getData(contentId);
    }
    @Override
    public void onResponse(Call<QuestionEntries> call, Response<QuestionEntries> response) {
        getView().showQuestion(response.body());
       // Log.e("自定义标签", "类名==QuestionPresenter" + "方法名==onResponse=====:" + "加载成功");
    }

    @Override
    public void onFailure(Call<QuestionEntries> call, Throwable t) {
       // Log.e("自定义标签", "类名==QuestionPresenter" + "方法名==onFailure=====:" + t.toString());
    }
}
